feat: implement GitHub Actions CI/CD pipeline#1
Merged
takaokouji merged 4 commits intomainfrom Sep 20, 2025
Merged
Conversation
- Add conditional lambda_handler definition using ENV["CI"] check - Prevent global lambda_handler definitions during test execution - Update Rakefile to set CI=true for all test tasks - Fix mesh zone test to use module method consistently Changes implemented: - All lambda_function.rb files now conditionally define global lambda_handler - Only define lambda_handler when ENV["CI"] != "true" - Rakefile sets CI=true for both :test and :test:lambda tasks - Fixed remaining test that called global lambda_handler directly Test results: - ✅ 29 examples, 0 failures (no warnings) - ✅ All lambda_handler redefinition warnings eliminated - ✅ Local SAM testing still works (CI env not set) - ✅ RSpec testing works cleanly (CI env set to true) This maintains backward compatibility for AWS Lambda deployment while providing a clean testing environment without warnings. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive GitHub Actions workflow for automated testing and deployment: CI/CD Pipeline Features: - **Triggers**: Push to main branch and Pull Requests to main - **Multi-job workflow**: lint-and-test → validate-sam-template → deploy Job 1: lint-and-test - Ruby 3.3 setup with bundler cache - Run `bundle exec rake standard` for linting - Run `bundle exec rake test` for comprehensive testing - Upload test results artifacts Job 2: validate-sam-template - AWS SAM CLI setup - Validate SAM template syntax - Build SAM application - Upload build artifacts Job 3: deploy (main branch only) - Deploy to AWS using SAM CLI - Requires AWS credentials from GitHub secrets - Stack name: smalruby-infra-prod - Deploys to ap-northeast-1 region - Upload deployment logs Security & Best Practices: - Environment protection for production deployment - Artifacts retention (7-30 days) - Conditional deployment only on main branch pushes - Uses latest GitHub Actions (v4) This enables automated quality assurance and deployment for the smalruby-infra Lambda functions and API Gateway infrastructure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
SAM build requires Ruby and bundler to be available for Ruby Lambda functions. This fixes the 'No such file or directory: bundle' error in GitHub Actions. Changes: - Add Ruby 3.3 setup to validate-sam-template job - Add Ruby 3.3 setup to deploy job - Enable bundler-cache for faster builds - Ensure consistent Ruby environment across all CI/CD jobs This resolves the RubyBundlerBuilder:RubyBundle error during sam build. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Comment out the deploy job in GitHub Actions workflow until manual deployment testing is completed. This ensures we can safely test deployment manually before enabling automated deployment. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a comprehensive GitHub Actions CI/CD pipeline for automated testing and deployment of the smalruby-infra Lambda functions.
Features Implemented
🚀 Multi-Job CI/CD Workflow
lint-and-test Job
bundle exec rake standardfor Ruby Standard Style lintingbundle exec rake testfor comprehensive RSpec testing (29 tests)validate-sam-template Job
sam validate)sam build)deploy Job (main branch only)
ap-northeast-1regionsmalruby-infra-prod🔧 Triggers
🛡️ Security & Best Practices
Required GitHub Secrets
To enable deployment, the following secrets need to be configured:
AWS_ACCESS_KEY_ID: AWS access key for deploymentAWS_SECRET_ACCESS_KEY: AWS secret access key for deploymentTest Plan
Breaking Changes
None. This is purely additive infrastructure.
Notes
🤖 Generated with Claude Code